<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学生列表</title>
</head>
<body>
    <table id="list" border="1">
        <tr>
            <th>姓名</th>
            <th>手机号</th>
            <th>身份证号</th>
        </tr>
        
    </table>
</body>
<script>

fetch('/student')
.then(res => {
    return res.json();
})
.then(data => {
    console.log(data);
    if(data.code){
        alert('没有信息');
    }else{
        let str = ``

        for (const i of data.data.values()) {
            str += `<tr>
                <td>${i.name}</td>
                <td>${i.mobile}</td>
                <td>${i.id_card}</td>
            </tr>`
        }
        let p = document.getElementById('list');
        p.innerHTML = p.innerHTML + str;
    }


});


</script>
</html>